home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacGofer 0.22d / MacGofer Sources / amigaint.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-06  |  1.6 KB  |  48 lines  |  [TEXT/MPS ]

  1. /* ============================================================= */
  2. /* intproc.c: February 1993, Frederek Althoff                    */
  3. /*            ifalthof@techfak.uni-bielefeld.de                  */
  4. /*                                                               */
  5. /* usage: intproc <ID>                                           */
  6. /*                                                               */
  7. /* Sends an interrupt-signal to the CLI-Process <ID>.            */
  8. /* This program was written to interrupt Gofer, running on an    */
  9. /* Amiga. Though it is only a makeshift, it will help you until  */
  10. /* the ^C-problem will be fixed.                                 */
  11. /* You may get Gofer's Process-Id by using the command C:Status. */
  12. /*                                                               */
  13. /* requires: Kick 2.x                                            */
  14. /* ============================================================= */
  15.  
  16. #include <dos/dosextens.h>
  17. #include <stdio.h>
  18.  
  19.  
  20. main (argc, argv)
  21.      int             argc;
  22.      char           *argv[];
  23. {
  24.   struct Task    *stopTask;
  25.   long            processID;
  26.  
  27.   if (argc != 2) {
  28.     fprintf (stderr, "Usage: intproc <Process-ID>\n");
  29.     exit (20L);
  30.   }
  31.  
  32.   processID = atol (argv[1]);
  33.  
  34.   Forbid (); /* Disable task-switching */
  35.  
  36.   /* Get address of the process */
  37.   if (stopTask = (struct Task *) FindCliProc (processID)) {
  38.     Signal (stopTask, stopTask->tc_SigAlloc);    /* Send interrupt-signal */
  39.     fprintf (stdout, "CLI(%ld) interrupted.\n", processID);
  40.   } else
  41.     fprintf (stdout, "No such CLI-Process: %ld\n", processID);
  42.  
  43.    Permit (); /* Ok, switch your tasks */
  44.   exit (0L);
  45. }
  46.  
  47. /* 25.02.93 */
  48.